#include <bits/stdc++.h>
using namespace std;
int k;
const int N=1e6+50;
vector<pair<int,int> >g;
char mp[1005][1005];
int main(void){
    scanf("%d",&k);
    int t=3;
    while(k>0){
        int i=0;
        while((1<<i)<=k){
            i++;
        }
        i--;
        k-=(1<<i);
        if(i==0){
            g.push_back(make_pair(1,2));
        }else if(i==1){
            g.push_back(make_pair(t,2));
            g.push_back(make_pair(1,t));
            g.push_back(make_pair(t+1,2));
            g.push_back(make_pair(1,t+1));
            t+=2;
        }else if(i==2){
            printf("%d\n",t);
            g.push_back(make_pair(1,t));
            g.push_back(make_pair(1,t+1));
            t+=2;
            g.push_back(make_pair(t-2,t));
            g.push_back(make_pair(t-2,t+1));
            g.push_back(make_pair(t-1,t+1));
            g.push_back(make_pair(t-1,t));
            t+=2;
            g.push_back(make_pair(t-2,2));
            g.push_back(make_pair(t-1,2));
            printf("%d\n",t);
        }else{
            g.push_back(make_pair(1,t));
            g.push_back(make_pair(1,t+1));
            t+=2;
            for(int j=0;j<i-1;j++){
                g.push_back(make_pair(t-2,t));
                g.push_back(make_pair(t-2,t+1));
                g.push_back(make_pair(t-1,t+1));
                g.push_back(make_pair(t-1,t));
                t+=2;
            }
            g.push_back(make_pair(t-2,2));
            g.push_back(make_pair(t-1,2));
            t+=2;
        }
    }
    for(int i=0;i<1005;i++){
        for(int j=0;j<1005;j++){
            mp[i][j]='N';
        }
    }
    int n=g.size();
    int gg=0;
    //printf("%d\n",n);
    for(int i=0;i<n;i++){
        printf("%d %d\n",g[i].first,g[i].second);
        mp[g[i].first][g[i].second]=mp[g[i].second][g[i].first]='Y';
        gg=max(gg,max(g[i].first,g[i].second));
    }
    printf("%d\n",gg);
    for(int i=1;i<=gg;i++){
        for(int j=1;j<=gg;j++){
            printf("%c",mp[i][j]);
        }
        printf("\n");
    }
    return 0;
}